from math import *


class Dot:
    def __init__(self,*coords) :
        self.coords = coords
        
    def __str__(self) : 
        s=""
        for c in list(self.coords) :
            s += str(c)+","
        return s[:-1]
        
    def distance(self, otherDot) :
        try :
            if len(self.coords) != len(otherDot.coords) :
                raise ValueError
            
            s = map(lambda s1,s2: pow(s1-s2,2), self.coords, otherDot.coords)
            return sqrt(sum(s))
        
        except AttributeError :
            raise ValueError
        
    def middle(self, otherDot) :
        try :
            if len(self.coords) != len(otherDot.coords) :
                raise ValueError

            d = Dot()
            d.coords = tuple(map(lambda s1,s2: ((s1+s2)/2.0), self.coords, otherDot.coords))
            return d
        
        except AttributeError :
            raise ValueError        
        